<template>
  <div>
      <div class="menu" v-for="item in  list" :key="item.id">
        <div class="item">
          <input type="checkbox" v-model="item.checked"/>
        </div>
        <div class="item">
          {{ item.goodsname }}
        </div>
        <div class="item">
            <button v-show="item.goodsnum>1" @click="calc(item,-1)">-</button>
            <input  v-model="item.goodsnum"/>
            <button @click="calc(item,1)">+</button>
        </div>
        <div class="item">
          {{ item.goodsprice }}
        </div>
        <div class="item">
          {{ item.goodsnum * item.goodsprice }}
        </div>
        <div class="item" @click="$emit('delListById',item.id)">
          删除
        </div>
      </div>
  </div>
</template>

<script>
export default {
  props:["list"],
  methods:{
    calc(item,num){
      this.$emit("calc",item,num);

    }
  }

}
</script>

<style>

</style>